package com.nsn.auction.dao.impl;

import java.util.List;

import com.nsn.auction.dao.CommentDao;
import com.nsn.auction.domina.Comment;
import com.nsn.auction.util.CustomHibernateDaoSupport;

public class CommentDaoImpl extends CustomHibernateDaoSupport implements CommentDao {

	@Override
	public void save(Comment comment) {
		getHibernateTemplate().save(comment);
	}

	@Override
	public void update(Comment comment) {
		getHibernateTemplate().update(comment);

	}

	@Override
	public void delete(Comment comment) {
		getHibernateTemplate().delete(comment);

	}

	@Override
	public Comment findCommentById(Long commentId) {
		List<Comment> list = getHibernateTemplate().find("from Comment where commentId=?", commentId);
		if (list.size() == 0)
			return null;
		else
			return list.get(0);
	}

}
